package com.mars.nacos.infrastructure.remote.facade;

import com.alibaba.fastjson.JSON;
import com.mars.nacos.infrastructure.remote.UserAppApiRemoteService;
import com.mars.nacos.infrastructure.remote.dto.response.UserInfoResDTO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * @author : kyrie
 * @date : 2022/8/24 09:58
 * #desc    : some description
 */
@Service
@Slf4j
public class UserAppApiRemoteFacade {
    @Resource
    private UserAppApiRemoteService userAppApiRemoteService;

    public UserInfoResDTO getUserName() {
        try {
            UserInfoResDTO userInfoResDTO = userAppApiRemoteService.getUserName();
            log.info("对接用户中心查询用户基础信息, 响应: {}", JSON.toJSONString(userInfoResDTO));
            return userInfoResDTO;
        } catch (Exception e) {
            log.error("对接用户中心查询用户基础信息异常: e=", e);
        }
        return null;
    }
}
